home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / C-D / DeveloperStax.cpt / Developer Stack 1.0 / card_11791.txt < prev    next >
Text File  |  1989-02-26  |  3KB  |  154 lines

  1. -- card: 11791 from stack: in.0
  2. -- bmap block id: 0
  3. -- flags: 4000
  4. -- background id: 3837
  5. -- name: DeleteFile
  6.  
  7.  
  8. -- part 1 (button)
  9. -- low flags: 00
  10. -- high flags: A003
  11. -- rect: left=82 top=302 right=324 bottom=182
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 1
  15. -- font id: 0
  16. -- text size: 12
  17. -- style flags: 0
  18. -- line height: 16
  19. -- part name: Install
  20. ----- HyperTalk script -----
  21. on mouseUp
  22.   if the optionkey is down then
  23.     pass mouseup
  24.   end if
  25.  
  26.   put (long name of this stack) into sourceStack
  27.   delete first word of sourceStack
  28.   delete first character of sourceStack
  29.   delete last character of sourceStack
  30.   put "Select a stack to copy this resource into."
  31.   put filename("STAK") into fname
  32.   if fname is empty then
  33.     hide message window
  34.     exit mouseup
  35.   end if
  36.   if sourcestack=fname then
  37.     beep
  38.     Answer "Get real.  You can't install it in this stack"
  39.     hide message window
  40.     exit mouseup
  41.   end if
  42.  
  43.   --
  44.   ModResCopy sourceStack,fname,"XFCN","DeleteFile"
  45.   --
  46.   get the result
  47.   if first char of it is "E" then
  48.     put it into the message box
  49.     beep
  50.     answer "Attempt to install resource has failed."
  51.   else
  52.     beep
  53.     answer "Resource installation successful"
  54.   end if
  55.   hide message window
  56. end mouseUp
  57.  
  58.  
  59.  
  60. -- part 2 (button)
  61. -- low flags: 00
  62. -- high flags: A004
  63. -- rect: left=224 top=241 right=292 bottom=283
  64. -- title width / last selected line: 0
  65. -- icon id / first selected line: 27056 / 27056
  66. -- text alignment: 1
  67. -- font id: 0
  68. -- text size: 12
  69. -- style flags: 0
  70. -- line height: 16
  71. -- part name: Try It
  72. ----- HyperTalk script -----
  73. --
  74. --12/15/87  ‚Ä¢‚Ä¢‚Ä¢Steve Drazga‚Ä¢‚Ä¢‚Ä¢
  75. --
  76. --This script needs XFCNs 'FilenName' and 'DeleteFile'
  77. --It also uses the HyperTalk function 'OsErr'
  78. --
  79. on mouseUp
  80.   if the optionkey is down then
  81.     pass mouseup
  82.   end if
  83.  
  84.   put "Please select a file to delete"
  85.   put filename() into deletethis
  86.   if deletethis is empty then
  87.     hide message window
  88.     beep
  89.     exit mouseup
  90.   end if
  91.   hide message window
  92.  
  93.   answer "Are you sure you want to delete this?" with "Cancel" or "OK"
  94.   if it is "Cancel" then
  95.     beep
  96.     exit mouseup
  97.   end if
  98.  
  99.   put deletefile(deletethis) into returnedthis
  100.  
  101.   if returnedthis = 0 then
  102.     answer "I hope you were sure, 'cause it's gone!"
  103.   else
  104.     if returnedthis < 0 then
  105.       OsErr returnedthis
  106.     else
  107.       answer "Whoops, there was an error"
  108.     end if
  109.   end if
  110.  
  111. end mouseUp
  112.  
  113.  
  114.  
  115. -- part contents for background part 5
  116. ----- text -----
  117. DeleteFile
  118.  
  119. -- part contents for background part 10
  120. ----- text -----
  121. 9
  122.  
  123. -- part contents for background part 6
  124. ----- text -----
  125.  
  126. This will delete the specified file from the disk.  Be careful, there's no turning back.
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133. Thanks to:
  134. Dewi Williams
  135. 2227 Juniper Court
  136. Boulder CO 80302
  137. (303) 443 9038
  138. Delphi: DEWI
  139.  
  140.  
  141. -- part contents for background part 7
  142. ----- text -----
  143. Syntax:
  144.  
  145. DeleteFile ("PathName")
  146.  
  147. "PathName" is the full pathname to the file you want to delete.  Do not use quotation marks around it.
  148.  
  149. The result will contain either 
  150. 0 (meaning a successful operation),
  151. 1 (meaning a parameter error), or
  152. a negative number (representing an operating system error).
  153.  
  154. You can use the 'OsErr' function provided in the script of this stack to interpret operating system errors.